﻿using MiniFox.Platform.Resources;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MiniFox.Platform.Exceptions
{
    /// <summary>
    /// 
    /// </summary>
    public class PlatformException : MiniFox.Exceptions.SystemException
    {
        string _code;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        public PlatformException(string name) : this(name, Resources.ResMessage.ResourceManager.GetString(name))
        {
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <param name="description"></param>
        protected PlatformException(string name, string description) : base(description, name)
        {
            _code = ResErrorCode.ResourceManager.GetString(name);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <param name="args"></param>
        public PlatformException(string name, params object[] args) : this(name, string.Format(Resources.ResMessage.ResourceManager.GetString(name), args))
        {

        }
        /// <summary>
        /// 
        /// </summary>
        public override string ErrorCode
        {
            get { return _code; }
        }
    }
}
